package com.yun.zf.common.admin.dto.customer;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class CustomerInfoDto {

    private String id;
    @ApiModelProperty(value = "客源id")
    private Long customerId;

    @ApiModelProperty(value = "需求类型1整租2合租3租商铺4租写字楼5买二手房6买新房7买商铺8买写字楼")
    private Integer demandType;

    @ApiModelProperty(value = "面积范围-隔开")
    private String area;
    private Map<String, Integer> areaRange;
    @ApiModelProperty(value = "预算范围")
    private String budget;
    private Map<String, Integer> budgetRange;

    @ApiModelProperty(value = "预算单位")
    private String unit;

    @ApiModelProperty(value = "房源装修情况")
    private String fixtures;

    @ApiModelProperty(value = "意向居室范围")
    private String bedrooms;
    private Map<String, Integer> bedroomsRange;

    @ApiModelProperty(value = "意向楼层")
    private String floor;
    private Map<String, Integer> floorRange;

    @ApiModelProperty(value = "楼龄，填写范围")
    private String buidYear;
    private Map<String, Integer> buidYearRange;

    @ApiModelProperty(value = "备注原因")
    private String remark;

    @ApiModelProperty(value = "如果出租必选出租方式1整租，2合租")
    private Integer rentType;

    public Map<String, Integer> getAreaRange() {
        Map<String, Integer> map = new HashMap<>();
        map.put("gte", Integer.parseInt(area.split("-")[0]));
        map.put("lte",  Integer.parseInt(area.split("-")[1]));
        return map;
    }

    public void setAreaRange(Map<String, Integer> areaRange) {
        this.areaRange = areaRange;
    }

    public Map<String, Integer> getBudgetRange() {
        Map<String, Integer> map = new HashMap<>();
        map.put("gte", Integer.parseInt(budget.split("-")[0]));
        map.put("lte",  Integer.parseInt(budget.split("-")[1]));
        return map;
    }

    public Map<String, Integer> getBedroomsRange() {
        Map<String, Integer> map = new HashMap<>();
        map.put("gte", Integer.parseInt(bedrooms.split("-")[0]));
        map.put("lte",  Integer.parseInt(bedrooms.split("-")[1]));
        return map;
    }

    public Map<String, Integer> getBuidYearRange() {
        Map<String, Integer> map = new HashMap<>();
        map.put("gte", Integer.parseInt(buidYear.split("-")[0]));
        map.put("lte",  Integer.parseInt(buidYear.split("-")[1]));
        return map;
    }

    public Map<String, Integer> getFloorRange() {
        Map<String, Integer> map = new HashMap<>();
        map.put("gte", Integer.parseInt(floor.split("-")[0]));
        map.put("lte",  Integer.parseInt(floor.split("-")[1]));
        return map;
    }
}
